<template>
    <div class='interestssJsuance'>
        <el-dialog :visible.sync="aportDialogVisible" width="20%">
            <span>确认通过审核吗？</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="cancel()">取 消</el-button>
                <el-button type="primary" @click="sure()">确 定</el-button>
            </span>
        </el-dialog>

        <el-dialog :visible.sync="refuseDialogVisible" width="20%">
            <el-input
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 4}"
                placeholder="请输入拒绝原因"
                v-model="movieProfitCheckParams.failedReason"
            ></el-input>
            <span slot="footer" class="dialog-footer">
                <el-button @click="cancelrefuse()">取 消</el-button>
                <el-button type="primary" @click="sure()">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import { ajax } from "@/api";
import { getToken } from "@/utils/auth";

export default {
    name:'interestssJsuance',
    data(){
        return {
            aportDialogVisible:false,
            refuseDialogVisible:false,
            movieProfitCheckParams:{
                movieId:'',
                success:'',
                failedReason:'',
                token:getToken()
            }
        }
    },
    methods:{
        //通过
        getAdopt(id){
            this.aportDialogVisible = true;
            this.movieProfitCheckParams.movieId = id;
            this.movieProfitCheckParams.success = true;
        },

        //拒绝
        refuseText(id){
            this.refuseDialogVisible = true;
            this.movieProfitCheckParams.movieId = id;
            this.movieProfitCheckParams.success = false;
        },

        //确认
        sure(){
            if(!this.movieProfitCheckParams.success && this.movieProfitCheckParams.failedReason === ''){
                this.$message({
                    message: '请输入拒绝原因',
                    type: 'error'
                });
                return false;    
            }
            ajax('movieProfitCheck',this.movieProfitCheckParams).then((res) => {
                if(res.data.status){
                    this.$message({
                        message: '通过成功!',
                        type: 'success'
                    });
                    this.aportDialogVisible = false;
                    setTimeout(() => {
                        location.reload();
                    },100);
                }else{{
                    this.$message({
                        message: '通过成功!',
                        type: 'error'
                    });
                }}
            });
        },
    }
}
</script>


<style lang="less" scoped>
.interestssJsuance{

}
</style>
